//package example.demo.mideng;
//
//import lombok.ToString;
//import org.aopalliance.aop.Advice;
//import org.springframework.aop.Pointcut;
//import org.springframework.aop.support.AbstractPointcutAdvisor;
//import org.springframework.aop.support.ComposablePointcut;
//import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
//
///**
// * 借鉴com.alibaba.druid.support.spring.stat.annotation.StatAnnotationAdvisor
// */
//@ToString
//public class MiDengAnnoAdvisor extends AbstractPointcutAdvisor {
//    private MiDengBeforeInterceptor miDengBeforeInterceptor;
//    private Advice advice;
//    private Pointcut pointcut;
//
//    public MiDengAnnoAdvisor(MiDengBeforeInterceptor miDengBeforeInterceptor) {
//        this.miDengBeforeInterceptor = miDengBeforeInterceptor;
//        this.advice = this.buildAdvice();
//        this.pointcut = this.buildPointcut();
//
//    }
//
//    public Pointcut getPointcut() {
//        return this.pointcut;
//    }
//
//    public Advice getAdvice() {
//        return this.advice;
//    }
//
//    protected Advice buildAdvice() {
//        return this.miDengBeforeInterceptor;
//    }
//
//    protected Pointcut buildPointcut() {
//        //如果类上有@RaoMiDeng，这个类上所有的方法都会被进行代理，如果类上没有而方法上面有，这个方法就会被代理
//        Pointcut cpc = new AnnotationMatchingPointcut(RaoMiDeng.class, true);
//        Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(RaoMiDeng.class);
//        ComposablePointcut result = (new ComposablePointcut(cpc)).union(mpc);
//        return result;
//    }
//}
